﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UniRlv.COL;
using UniRlv.Utility;

namespace UniRlv.UI.Main
{
    public partial class FrmPwdVerify : Form
    {
        public FrmPwdVerify()
        {
            InitializeComponent();
        }

        private void FrmLogin_Load(object sender, EventArgs e)
        {
        }

        private void btnQuit_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            Close();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {

            if (txtPwd.Text.Trim().Length < 0)
            {
                MessageBox.Show("密码不能为空！");
                txtPwd.Focus();
                return;
            }


            if (PublicObject.CurUser.password.Equals(txtPwd.Text))
            {
                this.DialogResult = System.Windows.Forms.DialogResult.Yes;
                Close();
            }
            else
            {
                this.DialogResult = System.Windows.Forms.DialogResult.No;
                Close();
            }
        }

        private void FrmLogin_Activated(object sender, EventArgs e)
        {
            txtPwd.Focus();
            txtPwd.SelectAll();
        }

        private void txtPwd_KeyDown(object sender, KeyEventArgs e)
        {
            if (txtPwd.Focused && e.KeyCode == Keys.Enter)
            {
                btnLogin.PerformClick();
            }
        }

    }
}
